<template>
  <div>
  <ul>
    <li v-for="(item,index) in arr" :key="index">
     <span> {{item}} </span>
      <button @click='del'>删除</button>
    </li>
  </ul>
  <button @click="addFn">生成</button>
  </div>
</template>

<script>
export default {
   data(){
    return{
      arr:[],
    }
   },
   methods:{
    addFn(){
      this.arr.push(Math.floor(Math.random()*100))
    },
    del(){
      this.arr.splice(this.index,1) //删除的第几项 删除的个数
   
    }
   }
}
</script>

<style>

</style>